package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.PurchaseReceiptItemMapper;
import com.ruoyi.business.domain.PurchaseReceiptItem;
import com.ruoyi.business.service.IPurchaseReceiptItemService;

/**
 * 进货单明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-20
 */
@Service
public class PurchaseReceiptItemServiceImpl implements IPurchaseReceiptItemService 
{
    @Autowired
    private PurchaseReceiptItemMapper purchaseReceiptItemMapper;

    /**
     * 查询进货单明细
     * 
     * @param id 进货单明细主键
     * @return 进货单明细
     */
    @Override
    public PurchaseReceiptItem selectPurchaseReceiptItemById(Long id)
    {
        return purchaseReceiptItemMapper.selectPurchaseReceiptItemById(id);
    }

    /**
     * 查询进货单明细列表
     * 
     * @param purchaseReceiptItem 进货单明细
     * @return 进货单明细
     */
    @Override
    public List<PurchaseReceiptItem> selectPurchaseReceiptItemList(PurchaseReceiptItem purchaseReceiptItem)
    {
        return purchaseReceiptItemMapper.selectPurchaseReceiptItemList(purchaseReceiptItem);
    }

    /**
     * 新增进货单明细
     * 
     * @param purchaseReceiptItem 进货单明细
     * @return 结果
     */
    @Override
    public int insertPurchaseReceiptItem(PurchaseReceiptItem purchaseReceiptItem)
    {
        purchaseReceiptItem.setCreateTime(DateUtils.getNowDate());
        return purchaseReceiptItemMapper.insertPurchaseReceiptItem(purchaseReceiptItem);
    }

    /**
     * 修改进货单明细
     * 
     * @param purchaseReceiptItem 进货单明细
     * @return 结果
     */
    @Override
    public int updatePurchaseReceiptItem(PurchaseReceiptItem purchaseReceiptItem)
    {
        purchaseReceiptItem.setUpdateTime(DateUtils.getNowDate());
        return purchaseReceiptItemMapper.updatePurchaseReceiptItem(purchaseReceiptItem);
    }

    /**
     * 批量删除进货单明细
     * 
     * @param ids 需要删除的进货单明细主键
     * @return 结果
     */
    @Override
    public int deletePurchaseReceiptItemByIds(Long[] ids)
    {
        return purchaseReceiptItemMapper.deletePurchaseReceiptItemByIds(ids);
    }

    /**
     * 删除进货单明细信息
     * 
     * @param id 进货单明细主键
     * @return 结果
     */
    @Override
    public int deletePurchaseReceiptItemById(Long id)
    {
        return purchaseReceiptItemMapper.deletePurchaseReceiptItemById(id);
    }

    /**
     * 根据进货单号查询进货单明细列表
     * 
     * @param receiptCode 进货单号
     * @return 进货单明细集合
     */
    @Override
    public List<PurchaseReceiptItem> selectPurchaseReceiptItemByReceiptCode(String receiptCode)
    {
        return purchaseReceiptItemMapper.selectPurchaseReceiptItemByReceiptCode(receiptCode);
    }
}
